package com.itruth.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Timestamp;

import com.itruth.dao.impl.ShareDaoImpl;
import com.itruth.entity.ShareEntity;


public class ConnUtil {
	
	private static final String URL = "jdbc:mysql://localhost:3306/test";
	private static final String USERNAME = "root";
	private static final String PASSWORD = "lanyan";
	
	static {
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
	
	public static Connection getConn() throws SQLException {
		return DriverManager.getConnection(URL, USERNAME, PASSWORD);
	}
	
	public static void main(String[] args) throws Exception {
//		UserDaoImpl ud = new UserDaoImpl();
//		User u = new User("lanyan27", "pw_lanyan");
//		ud.insert(u);
//		System.out.println(ud.accountIsExist("lanyan28"));
		
		ShareDaoImpl sdi = new ShareDaoImpl();
			ShareEntity se = new ShareEntity("a1", "内容", new Timestamp(System.currentTimeMillis()));
//			sdi.insert(se);
//		sdi.query(3);
	}
	
}
